import Vue from 'vue'
import VueRouter from 'vue-router'

const Login = () => import( '../components/Login.vue')

const Home = () => import('../components/Home.vue')
const Welcome = () => import('../components/Welcome.vue')
const Institution = () => import('../components/Institution.vue')

// 账户管理
const UsersList = () => import('../components/account/UsersList.vue')
const UserInfo = () => import('../components/account/UserInfo.vue')
const Pwd = () => import('../components/account/Password.vue')

// 权限管理
const PermissionList = () => import('../components/permission/PermissionList.vue')
const RoleList = () => import('../components/permission/RoleList.vue')

// 分类管理
const Category = () => import('../components/category/Category.vue')

// 物料管理
const MaterialInfo = () => import('../components/material/MaterialInfo.vue')
const Params = () => import('../components/material/Params.vue')

// 出入库管理
const Entry = () => import('../components/record/Entry.vue')
const Exist = () => import('../components/record/Exist.vue')
const BatchEntry = () => import('../components/record/BatchEntry.vue')

// 日志管理
const LogInfo = () => import('../components/log/LogInfo.vue')
const LogRollback = () => import('../components/log/LogRollback.vue')

// 数据统计
const Reporting = () => import('../components/data/Reporting.vue')

// 超管设置
const Menu = () => import('../components/super/Menu.vue') // 菜单管理
const Resource = () => import('../components/super/Resource.vue')  // 资源管理
const Organization = () => import('../components/super/Organization.vue')  // 组织管理
const Special = () => import('../components/super/Special.vue')  // 专业管理
const File = () => import('../components/super/File.vue')  // 专业管理

// 仓库管理
const WarehousesList = () => import('../components/warehouse/WarehouseList.vue')


Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/login' },
    { path: '/login', component: Login },
    
    {
      path: '/home',
      component: Home,
      // redirect: '/welcome',
      redirect: '/institution',
      children: [
        { path: '/welcome', component: Welcome },
        { path: '/institution', component: Institution },
        { path: '/users', component: UsersList },
        { path: '/info', component: UserInfo },
        { path: '/passwords', component: Pwd },

        { path: '/permissions', component: PermissionList },
        { path: '/roles', component: RoleList },

        { path: '/categories', component: Category },

        { path: '/materials', component: MaterialInfo },
        { path: '/params', component: Params },

        { path: '/exist', component: Exist },
        { path: '/entry', component: Entry },
        { path: '/excel', component: BatchEntry },
      
        { path: '/logs', component: LogInfo },
        { path: '/rollback', component: LogRollback },

        { path: '/reports', component: Reporting },

        { path: '/menus', component: Menu },
        { path: '/resources', component: Resource },
        { path: '/organizations', component: Organization },
        { path: '/special', component: Special },
        { path: '/files', component: File },

        { path: '/warehouses', component: WarehousesList },
      ]
    }
  ]
})

export default router
